package com.ljw.servlet_springMVC.annotation.controller;

import com.ljw.servlet_springMVC.annotation.service.HelloService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @FileName HelloController
 * @Description TODO
 * @Author ljw
 * @Date 2021/2/5 14:38
 * @Version 1.0
 */
@Controller
public class HelloController {

    @Autowired
    HelloService helloService;

    @ResponseBody
    @RequestMapping(value = "/hello",produces = {"application/json;charset=UTF-8"})
    public String sayHello(HttpServletRequest request, HttpServletResponse response){
        String mes="你好！";
        String hello = helloService.sayHello(mes);
        return hello;
    }


    @RequestMapping("/suc")
    public String successPage(){
        return "success";
    }
}
